package com.navi.loaddata.loadService.impl.Dcdata.cell1;

import com.navi.loaddata.core.mesEntity.SpcDcResultData;
import com.navi.loaddata.core.mesEntity.SpcDcdata;
import com.navi.loaddata.core.mesEntity.SpcDcmeasuredataresult;
import com.navi.loaddata.core.mesEntity.SpcDcprocessdataresult;
import com.navi.loaddata.core.mysqlEntity.EtlConfD;
import com.navi.loaddata.core.mysqlEntity.EtlConfDModel;
import com.navi.loaddata.core.repository.impl.MesRepositoryImpl;
import com.navi.loaddata.core.util.ProcessUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;

@Service
@Transactional(transactionManager = "mesPlatformTransactionManager")
public class LoadDcInfoServiceCELL12 {

    @Autowired
    private MesRepositoryImpl mesdao;

    public List<SpcDcdata> loadDcDataList(EtlConfDModel etlConfD, String dctype) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
        StringBuffer hql = new StringBuffer();
        hql.append("FROM SpcDcdata WHERE processoperationname<'L4100' and TIMEKEY >='")
                .append(sdf.format(etlConfD.getRunStartTimestamp()))
                .append("' and TIMEKEY < '")
                .append(sdf.format(etlConfD.getRunEndTimestamp()))
                .append("' and subfactoryname = '").append(etlConfD.getShop()).append("' ")
                .append(" and processoperationname not like 'DUM%' AND nvl(SUBSTR(PROCESSOPERATIONNAME, 6,7),'X') <> 'D'");
        if (!StringUtils.isEmpty(etlConfD.getOpe())) {
            hql.append(" and processoperationname = '").append(etlConfD.getOpe()).append("' ");
        }
        hql.append(" and dctype IN(").append(dctype).append(")");
        String hql1=hql.toString()+" and materialname in ('C185501QCF','A184V012BP','C185600TBJ','C185E01NAN','C185G007AM','A185500SAN','A184V015AG','C184P01YAF','A185601CCG','A185200GAX','C185F02MAW','A185G003AA','C185900ABM','C1852023BQ','A185400PCA','A185F006AM','A1857018AJ','C185E01WAV','C185G00BAN','C185E01JAR','C185G009AX','A1855021AT','A184T02CBY','A1853001BQ','C185C022BC','A185M006AM','A185H00PBQ','A185L00EAB','C185F015CC','A185700GAX','C185F02HBD','A185403EBA','C185F01ABM','C185E01XAX','A185400VAW','C185F01AAH','A184L01FCC','C185501LBB','C184900ABK','C185G00BCF','A185200DAM','C185800FBN','C185E01SAX','C185F017AR','C185E01MBB','A1854038AR','C185F02JBE','C185F02RCK','C185F02LCK','A1852025AD','C185701HCE','A1854029CJ','C185E01MAX','C185E01NAA','C185F02LAM','A185500SBY','C185F02JCH','C185G008BJ','C185E01MBK','A185601HBK','C1853028BR','A1851013AD','A185202HAW','A185500SBG','C185F016BT','C1855023AD','A1852023CH','A185500WAK','C1859011AL','A185400WAA','A1857012AA','C185F016AQ','A184T02EAT','C1855023AU','C185F01CAG','A1857012AJ','C185E01KBK','A185402TCK','A185B00GAV','C185700EBB','A185400UAK','C185J01HCK','C185401BBF','A185601JAR','C185C022BY','A185700GCC','C185D00LAV','A185501EAB','C185901TBW','A185800PAG','C185D01UBL','C1857004AV','C1857006AB','A1853026BK','A184T01LBP','A185601XCJ','C185C018AD','C185C01SAW','C185G008AA','A1857019AD','A185800NBG','C184V00UBN','C185G008AP','C184Q01LCE','C185Q00YAH','C185F02HBK','C185F02NBW','C185900XAL','A184V029CB','A1854029BP','A185502NBD','A185N00LBP','C185201RAW','A185701CAX','A185800PCK','A185R01BBC','A185S010BT','A185T024BD','A185800SAG','C185601MAR','C1859011BQ','C1855018BK','C184V009BU','C184E00XCK','C185C029AW','C185101DBQ','A184V013CD','C185701EBJ','C185601GBQ','A185701FAH','C185G009AL','A185700YAT','A185800WAU','A185501EAL','A185800NAH','A185S01AAR','A1853024BT','C185F02KAV','C185F017BJ','C185G003BA','C185F02MAC','C185E01HAT','A185700LAB','A185R017AL','A185800HAN','A185W004AA','A185T024BL','C185E01QAC','C185G008BM','A185C013CD','C185F02PAR','C1855012AN','A185L00KAG','C185F01AAU','A185700HAU','A185900TBP','A184C017AD','A185R018AD','A184C017AL','A1853024AT','A185601HAB','A185701CCD','A185701EAB','A184V02ECE','A185Q00MAT','A185T009AL','A185S012AG','A185800XAD','A185S01BCK','A185900JAY','A185601XBB','A185V018BA','C184N026BG','C185F02KAF','A185T00ABN','A185T02FAA','C185601EBJ','A185S019AV','A185H00NAW','A185601XAN','A185U015AY','A185Q00FBY','C185F01EAC','C184L019BU','C185101AAG','A185502FBT','A185K00XBE','A185900WAU','C185201BBE','A185H027AD','A1857019CK','C185Q027AV','A185402BCK','C185G005AB','C185F015BK','C185E020BR','C185F02QCG','C184V00TCJ','C185E01XAA','C185901XAG','C185E020AN','C185E01NBC','C184W010AJ','C185F02NBA','C185E01LBU','C185E020BY','C184U00RCA','A185T02BCJ','C1855013BH','A185502AAL','C185E01RBK','A185M009BU','C1856008AR','C185F02PBL','A185201TAS','A185S00VBH','C184U00WBP','C185E01LBV','C185601GBF','C185601MAF','A185W00JAX','A185W00HAS','A185W00GAL','A185W013BS','A185K004AE','C1853016AS','C185F02NCJ','C185601CAL','A185H02BBD','A185K002AW','A185K00BAM','C185R00XBY','A185M005AA','A185H00NBG','C185G004BN','C184T00NAS','C185200FBX','C185500NCE','A185S015BA','A185U013AW','C185K01MAP','A185T023AL','A185R00YCC','A185M00BBR','C185K01ACD','C185R028AV','A185Q00NBR','A185U00YAW','A185N006AP','C185D01QBU','C185600BAQ','A185M007AM','A185T02FBT','A185T02FBW','A185W017CJ','A185W00LBG','C184H00ACD','C1856009BH','A185V031AL','A185W005CB','A185R019BS','A185W012AB','A185W00MBV','C1852023CE','C1856008BD','A184T02BAV','A1856029BE','A1854010BJ','C185G00BBR','A185501EAF','C185G00AAJ','C185F016AF','A185400NBS','C185F02LAW','A185200FBP','A185502KBV','A1853001BA','A1853001BE','A185L00DCJ','A185N00GAP','A185P00QBK','A185M007AW','A185K001BL','A185M00KAA','A185N00MBD','A185N00GAF','C185E01XAQ','C185F01ACD','A185402TBX','A185700YAD','A185701FCH','A1856003CC','A184M01PBW','C185E01SBN','A185403JBK','C185F02QCK','A185403EBU','A185400QAR','C185E01TAT','C184A003AN','C185F02GBU','C184Q02QAY','C185F017AP','A185200FCE','C185E01XAW','C185F01BAS','C185G007AR','C185501UBC','C185F02RBM','A185402TAM','A1857019BE','A185700LBG','C185E01MAN','C185E01RAS','A1853003BA','A185502LAW','A185500UCK','A185500UCH','C185E01PAJ','C185700NAW','C185E01QCA','C185G00AAN','A185402UAJ','C185F019AP','C185E01VBX','C185E01MAC','C185F02MAL','C185F01BBK','A185403CAM','C184V00UAX','A185601XAB','A185201WBD','C185201CAY','C185G008CG','A185402TCJ','A185C01QBW','C184Q01LCB','A185M00BAA','A1853002AP','C185Q037BR','A185K00VBS','A1854014BH','A185601GAH','C185400JCB','A184T02GCF','A185800SBD','A185701BAY','C1856014AB','C185100UAE','C185T01NCH','C185R009BC','A185N005AR','A185900NCD','A185K00UAQ','C185K01GBL','A1854010BP','A1853014AD','A1852027AD','C185K017BJ','C185R009BD','A185800FCD','A185403CAK','A185G010CK','A185700LAU','C185701JAM','C1857019BD','A185800KBS','A185701AAX','A185T024AX','A185R010BG','A185G004CB','C1855020BX','A185Q00WAC','C1856027BG','A185R012CA','C1858014BP','A185T024AH','A185700XAA','A1856010BE','A185600SBR','A1856010AH','C185F01BBE','C185600EAC','A185P00LBD','A185T029CH','A185S01AAQ','A185701CAB','A184T01QBN','A185701EAM','C185F01DBX','A185900NAW','A185800KBB','C185E01LAT','C185F02MBD','A185M00KAE','C184N027AG','C184A01NAT','C184W008BF','A185700HCF','A185M005CA','A185S015BT','A1853015CA','C185G01NCA','A1857019AT','C185G00BAC','C185201BAD','C184T00LAP','C185101ACB','C185G002CD','A185W014AJ','A185K00VAY','C185100MCE','C185F02JBU','A185C00QAL','A185501CCF','A185502LAS','C1853017BH','A184500VAL','A185S010AU','A185502FCK','A185701EBM','A185800HCG','A185900LBJ','A185900JBF','A185502NAF','A185J00QAN','C185E020BJ','C185G004BJ','A185W005CG','A185K00DAV','A185P017AD','A185X007BE','C1855008AB','A185N00JCK','C185601MBG','A185P01DBR','A185W00FBE','C185101HAQ','A185T022BQ','A185502AAC','C1834004BG','A185502JAC','A185C00QAE','A185500WCG','A184N01BBA','A185601YCE','A185K00XBG','A185K00RBV','C185302NAD','A1853001CG','C185F017BC','A185L00EAU','A185L00EBD','A185M009CG','C185Q01TCJ','C185K01HAA','C185G003CD','C185F01BCF','C185501QCB','C1854019BL','C185F02GCD','C184C018AB','C185302GAA','C185G008CA','A185W00FCG','C185F02KAA','C185E01TAQ','C185700DBY','A185V02CAY','C185B011BP','C185F02QBY','C185401CBQ','C185500DBV','C185F017BP','A185L00AAQ','C185800DCF','C185F02GAG','A185S017CF','A185W00HAH','C185500QBF','A185W00KBM','A185V00MBM','C185G00AAD','C1859009BU','C185H02CBE','A185L00DBF','A185F00KBB','A185M00DCJ','A185P01EBA','C185300PBH','A185N00AAA','A185M00ABY','C185E01PBL','A185R016AY','C185601EBU','C185J01LBK','A185M005AX','A185U016AG','A185S00XAB','C184M022BR','C185501PBG','A185K00PAM','A185G01GCE','C184V008CK','A184N01EAV','C185M03BCH','C185600NBA','C184T00RAC','A185S01CAU','A185R01BAV','A185R00XAT','A185V031BW','C184P00GAJ','C184M00CAS','C184P00LBA','C184W00YBM','C185K01GBH','A185U016BC','C185R00YAM','C185600SAW','A185P019BM','A185W00MCC','A185V031CA','C1856007AJ','C185800VBP','C184P01FAF','C185800EBD','A185Q00FAK','A185600SAA','A185502BBT','A185502ABA','A1856011BV','A185601GAC','A185H00SBY','A185H00LCE','A185H00LCK','C184Q02SAB','A185400PBA','A1854039BU','A185200FCD','A1853015AU','A184T01QCJ','A185K00JCE','A185J00TBG','A185M00KAR','A185M00KAN','A185M00DAE','C185F01ACB','C185E01LBW','C185G007AU','A1853008AA','C185F01AAL','C185E01LBP','C185F017BK','A1857010BJ','A185800HCA','C185F018BV','A185502LAN','A184M01PCH','A1852008AA','C185F02HBQ','C185F01EAG','C185300PBQ','C185E01PAP','A185300AAN','C185G002BH','C185G005AX','C185F01UAC','A185400SBT','A185601GAR','C185F02LAV','C185E01QBT','C185G009CJ','C185G009BF','A185800SBB','C185G00BAS','A1853002AY','A1856028AA','C185E01SAN','C185G007CG','C185E01SBY','A185200FAW','A1853003CJ','C185F02GCC','A185400NAN','A184T01LBQ','A1852023CB','A185701ABJ','C184N02EAY','A1854033AL','C185600PAW','C185E01RCA','C185E01QCH','C185F02HBL','C185G007AS','A185502JAT','A185402TCH','C185F02PBW','A185J00NAY','C184W008BY','A185800WBB','C1854011CK','A185700BAS','C185500MCF','A185400PAY','C184V008AV','A185502JCG','A1855010BF','C185600NAS','C185E01HBA','C185E01VCH','A1853003AQ','C185E01NBB','C185F02NCH','A185700GBM','A185403CAX','C185E01XCD','A185L00KBR','A185502JAF','A185501EBD','A185300AAY','C185F01EBU','C185F01BBB','C185F02JAE','A185501CBH','A185C013BR','A185P00LBK','A185S010BW','C185D02GAH','A1852027AS','A184U00YBA','A185R00VBX','A185T024BU','C185301TBT','C185E01UAQ','C185900AAE','A185501EBP','A185501CBR','A185500XBC','A185W012AC','A1855010CJ','A185601RBD','A185L00ABT','A185800MAD','A185502MBG','A185R019AH','C185F02NBG','C185F01AAR','A1856020AC','C185F01EAX','A185800LCG','C185E01KAM','C185302EBS','C185F018AC','A1857019AV','C185E01HAB','C185701DBP','A185502MAW','C185E01VAW','A185W017BA','A185R015CA','C185R01FBB','C185P02LAQ','C185F02NBC','A185W004BD','C185F019BJ','A185W014AC','C185E01QBM','C185E01JAK','C185F02KCJ','A185C013CG','A185T021AT','A185S010CH','A185W013BD','A185500UBQ','A1854039AP','A185502FBS','A185U022AT','A185Q00PAA','A185502BAR','A1852027AR','C185E01RCB','C184V00ACB','A185800FBW','A185800HBQ','C183F00XBJ','C185F01DBP','A185W00KCK','C185E01XBJ','A185L00PAA','C185800YBV','A185T023AK','A1853017AG','A185R016AE','C185Q026AW','C184V005AS','A185W00QCE','A185T026CE','C185F01ECH','A185S019BQ','C185F018AP','C185E01JBN','C185F02RBW','C184N026CA','A1853003BC','A1851013AP','A1854011BW','C185F018CF','A185D00LAU','C185A00XBD','A184T01PAR','C185F015BN','C184T00RAD','C185A00JCD','C185600UAC','A184W00JAT','C185H02DCE','C185Q02YBL','C184V00WBU','C185E01UBB','A1857010BP','C185F02LBK','C185F01CBR','C185G003BM','C185A01EAL','C185501QAG','C185A012AY','C184V00PBK','A185L00ABD','C185F02NAB','A185W00FCK','A185W00FCE','C185700MCF','A185W013AD','A1854039AB','A185K00HCF','A185W00GAW','C185E01MAV','C184V008AQ','C185901UAY','C185G008AY','A185W00GBE','C184W00VBW','C184W01CCK','A185U00MBD','C185E01VAK','A185U014BJ','C185E01VAV','A185W00GAJ','C185800YAY','C185400JBW','C185R01FAE','C185G005BB','A185G00UBS','A185K00XAB','C185200DAM','C185J01LCB','C183J00WAT','C185P01BAJ','A185M00MAQ','A185L00FCA','A185L00CAU','A185K00ABY','A185S01CAK','A185V018BK','C1852023AC','C185601JBX','C1852028CH','A185J00NCE','A185K00UBN','A185L00KAK','C185P00EBE','C185F02PBV','A185T02CAU','A185T021AN','A185L00FBF','A185L00FAK','A185L007AU','A185K003AD','A185S00XCG','A185G01GAD','A185E00QBJ','A185L00DBB','A185G003BP','A185X00XCH','A185T02DBG','C1855011AW','A185R00QBL','C185B00YAF','C185800VBR','C183L00GCA','A185U00MAT','A185S01ABB','A185W00PCH','A185V017CH','A185V015AB','A185M00BCD','A185P01EAS','A185P00TBK','A185M00ECA','C185Q028AJ','A185X00BBS','C1856023BB','A185P01DBW','C185Q026AL','A1853015BE','C185301TAR','A185601NAU','A185601CCB','C185E01HAY','A185401WBS','C185F02NAR','A1856004AV','C185E01LBS','A185400NCJ','C185F015CH','A1853009BT','C185F018CE','C185F02RAS','C185F02LBF','C1859009BY','C185E01VCD','C185F01EBL','C185E01PBH','C185F02GBN','A185200FBX','C185G00BBQ','C184V019AD','A185800SBR','A185600SAC','A185502ABS','A185M00KAP','A185L00LBV','A185M008AT','A185L00NBU','A185M00HAA','A185M004AT','C185F01ABD','C184S00DBA','C184T00RCC','C185F017AN','C185F02RBN','A185403EAP','A185402UBD','C185E01WAU','C185G007BD','A185700HCH','C185G00RCH','C185E01UAR','C185D01QAD','C184M00CBE','C185G007AL','A184L01FCA','A184N01BBH','A184T01LAM','C185F02NAA','C185E01MCD','A1854010AX','C185E01MAG','C185E01WCE','C184V00PAJ','C185302LBC','C185302EBT','C185E01RBH','C184N00LAG','C185F02HAS','C185E01MAA','C185F01CAM','A185800SBF','C185400LBC','C184V01NAD','C185E01WCK','A1853003CG','A1852023BY','A185200FBQ','A185502ACA','A1852005AU','C185E01PAY','C185E01VCE','A185502KAF','C185E01LBJ','A185500SBX','A1853025AE','C185F02HAX','A1852023CC','C185E01PAN','C184Q01LAU','C184V00AAG','C185F017CK','C185G009BB','A185700EBU','A1855022CD','A185701EAY','A1852007AA','A185403EAG','A185400NCF','A1856005BF','A185202JAH','A185701BAS','A185402TCE','A185601BAX','C1856006BB','C185201EBP','C184P01KAE','C185900AAV','C1852010AS','C185901QBQ','C185D01WAR','C185G002BG','A185601RCG','A185900WAT','A1854033AQ','C184T00RAM','A1854033BJ','A1857011BK','C185G004CK','A185800KBE','A185N008AN','A185501CCB','A185C00RCG','A185900VBN','A185S017BV','A185S017AK','A185R010BA','A185F00BBV','A185T024AJ','A185E00VAE','C185200GAV','C185901VAC','C1856023BA','A185V02CAS','C185700NAP','C185300NCK','C185900XAH','C185301TAG','C185401LAP','C184P01KBD','A185800UBH','A185600SBS','A1856010AM','C185D02GBV','A185N00MBT','A185T02EAK','A1854039AF','A185C013BY','A1857018CH','A1857018BX','C185201RBJ','A185800LCJ','C185501VBD','C185F02PBB','C185E01PBU','C185F02JAP','C185F02GAR','C185E020BM','C185F01DBF','A185S015BE','A185800MAN','C182E005BJ','A185W004BA','C185E01MBX','A185C00RCH','A185N004AQ','C185700MCE','A185400VBG','C185600UAD','A185502AAP','A185800XAM','C185F01ABE','C185F02PAG','C185E01SBD','C185A00HCE','A185T026BJ','A185T026CA','C185T01SBK','A185P01BCD','C1856012AD','A185K00VAT','A185F00GBF','C1855017AQ','A185K00SBA','A185U015AX','A185M006AN','A185T021BU','A185500UBV','C185500YAE','A185S012BP','C185R023BQ','A185T009CD','A185V02AAF','C184S00RAX','C185E01VAE','A185K00SCJ','C185A01GBH','C185501WBR','A185H00MCH','A185G004AG','C185D02GAW','C185701DAT')";
        String hql2=hql.toString()+" and materialname in ('C185F02MAG','C185E020CD','C185F01AAP','C185G009CH','C185F01CBH','C185E01LBQ','C185A019CG','C185600MBJ','C185302FAA','C185B00VBK','C185601XBU','C182Q00SBC','C185F02NBE','C185401HAX','C1858014CG','C185F02QCD','A185P01BAP','C185E01PBK','C185D01XCH','A185W012AS','A185W00FCD','C184U00DAH','A185H025BT','C184Q014BN','A185T02CCB','A185T026BB','A185W00GBT','A185V014AJ','C184P020AT','C185A01FBD','C185C016BA','A185U00WCC','A185H01RBU','A185N00CCJ','A185D00CBV','C185R01HBG','A185M00EAF','A185L00BBG','A185M00MAR','C185F01ACE','A185M00ACC','C185A00NCG','A185N009AQ','A185S01CAD','A185R00XCC','A185T02GBR','A185V018BQ','A185H00LBF','C185E01TCB','C185101BCA','C185F01CAV','C185R00WCG','C185G002AQ','A185L00FAQ','A185L00BAT','A185K002BV','A185M00ABE','A185D00CAB','A185J00QAQ','A185T009BG','C185901VBF','A185N00GCG','A185T02CBC','A185P01GAP','A185V02CBB','A184V02FBE','C185R02AAL','A185W015BT','C1858010CJ','C182Q00RAV','A185Q00PAU','A185V01BBD','A185V01BCD','C185P006AU','A185V016CE','A185M009BR','A185K00PAL','A185W00HCC','C185E01MCG','A184V019CB','A1856010AA','A185500SAT','C185E01HBL','A185500SAQ','C185G004AE','C185G00ABV','C185E01MBT','C185E01KAL','A185500QBG','A185400NBX','A184W026AP','A1854039CK','C184E00YCD','A185G00SAQ','A185G00QAB','A185400LAM','A185500SBP','A1854034BJ','A1855022AP','C184J01LAV','A185L00JBV','A183M00RBE','C185F02KCD','A185M00JCE','A185P00TBR','A185P00TAG','C185F02JBR','C184Q02SAM','A185500WAD','C184B00RCG','A184M01PBL','C1857019BR','A184T01LBB','C185G002AA','A185402TBA','A185502LAR','C185F02PCE','C185G00RCK','C185F01BBP','A185900WCD','A184T01YBM','C185E01HAR','A185500UBK','C185F01BAM','C185G003CG','C185F02JAA','C185E01QAB','C185F02PBC','A185700NAT','A1854033AS','C185E01HBF','A185403CAP','C185E01JCG','A185501ECJ','A185400MBC','A185500SCF','A1853026BT','C185E01RCK','A1853003BB','A185502ABT','C185800VBA','A184M01SBB','C185G00UBN','A185402UAX','C185G005AK','C185G00BAD','C185201RBP','A184T01NAV','A1856005AR','C185F019AJ','C185G00BCK','A1853003CB','C185900CBH','C185E01QBY','C185F02KBT','C185F02PAQ','C185G007BG','A185403EAC','A185402TCC','C185E01SAV','A185900TAN','A185502JBF','C1855020AN','C1855016CK','A185502NCE','A185800FAA','A185700LAS','A185200BAE','A185401WAW','A1853024BK','A185601GAN','A185400NCD','C185C01RAT','C185B00UAC','C185U00NBR','A1853027CK','A185300AAX','C185E01VCJ','A185401WAR','C185200EAS','C1855022BG','C185F02NCD','C185D02GAD','A185500WBE','C185A00KBA','A184V01ACG','C185600NAR','A185700AAJ','A185C013BS','A185T024AV','A185D008BX','A185C013AV','A185Q00LAR','A185T024BA','A185T024BN','C185G009BD','A185700NAM','C185901VCE','C1857004BH','C185901XAX','A185U014BD','A185W016CA','A185700EBL','A185403JAN','C185F019BE','A1857019AS','C185F01ECG','A185T029CK','A185800NAK','C185800XBS','A1857018CG','C185101BAE','A185400PAG','C185F01BAX','A185B00EBD','C185G008AN','C184W00FAC','A185700VAG','C1855023AN','C185E01JBU','C185G00ABU','C185200FBQ','A185800MAF','A185W005CK','A185W014AA','C185800BBC','C185F02JAB','C185G00UAD','A185C013CH','A185C00RCB','A185U022AJ','A184V02FAS','A1857018CA','C1854015AK','C1856014BS','C184M029BA','A185900TAL','A185701EBW','A184H01GAH','A185800XAQ','C185G006BU','A185601XAH','A185900NAE','A185R016BE','C185302NBP','C185600FAM','C184Q01KBF','A185T023AW','A185W013BL','A185L00MAV','A185Q00QAV','C1853027BS','A185L00FAL','C185R012BY','A185701BCK','C1855012AY','C185600QBU','C1851009BM','C185800YBB','C185P02VBF','A185U00MAF','A1855024BU','C185700NBD','A185A00LBK','A185K00SBR','A185D00CCA','A1854039AC','C185F01EAP','C184A01MAC','C185E01PAU','C185701GBD','C185500YCA','C1856011BP','C185J01LAC','C184U00FCK','C184G00BBX','C183D00EAE','C185D01VAJ','C185700QCD','C185F02NBS','C182K001CC','C185G00AAL','A185900UBC','C184901RAS','A185V02CBL','A185V016AL','C184W01AAJ','A185V02BAB','A185W005BU','C185F016AR','C185G005CH','A185W00KBW','C185F02QBE','C185601JBE','A185T029AT','A185P01BCF','A184V02FAR','A185Q00MBG','A185V02ABR','A185W00KBF','C185401BAF','C185901YAN','C185601KBQ','A185V02BAN','C185100SBE','A185L00PCK','A185K00XAK','C185302FAW','C185L01KAQ','A185L00MAB','A185L00MBF','A185K002AX','A185S01CAC','C184V00WCG','C185E01LAE','C185F02NCB','A185H00UAF','A185U025CA','C184F00UAT','A185K00PBV','A185K00CCF','A1857016AV','A185R00WCC','C185N01YCH','A185L00BCH','A185K00TAL','C185T01SCB','C185100TBK','C185201MBM','C185501MBP','A185J00TBU','A185M00EAT','C1855023AM','C184N00MBS','A185J00SCA','C185101ECF','A184J00QBG','A185V033CE','A185T027BQ','A185V032AF','A185V018AR','A185T02BBJ','A185U015BS','C185500PAU','C1855014BP','A185N00GAY','A185T02CCC','C1856020BA','A185Q00PCB','A185W00KAM','A185W00FBL','C184S00SBA','A185400WBS','C185E01NBA','A1854039BY','C185E01JBE','C185E01JCB','C185F01ABS','A185403CBU','C185G004BY','A185700NBE','A185402BBG','A185G00PAE','C185G00UAC','C185G002BB','A185H00MBC','A1853005AF','A184M01PAN','C185J01MAJ','A185400SAY','A185J00QCK','A185M00HAB','A185M00CCA','A185K00SAA','A185F00FCB','C185E01WAR','C1855013BV','C185E01KBE','A1857018AT','A184T02FCD','C1852024AA','C185100RBS','C185601YCG','A184M01PBT','A184M01PCC','A185400MCB','C185G006AA','C185E01QCE','C185E01TAE','C185F01CCE','A184M01PAF','A1854029AA','C185F02MCG','C185E01XAD','C185G007BU','C184S00UBU','C185F019BG','C185F01DBW','C185G00ABX','C185D02GBH','C185G007AD','A185200FBS','A1853003CH','A185500UCD','A184W027BN','C185F019CB','C185101ECD','C185E01VBP','C185E01VCB','C185F02KCK','C185G002BK','A1853005CK','C185G00UBC','A1852023CE','C185E01PCD','C185100QBQ','C185800CBK','A185B00GBH','C185600QCD','C185501VAG','A185701BAB','C185R01HBE','C1855022AL','A184G00XBM','C1856025AV','C185T01PAH','C185U00BBL','C185T01QBE','A185701EBQ','C1852021AT','C185901XAU','C185201RBS','C184W007BB','C185G007AP','C185Q035AC','C185F018AG','C1858012BT','A185700WAK','A185G004CA','A185701CAW','A185500YAK','C185G008CD','C184Q01LBQ','C185101HBG','C184U00TAE','A185C00QAH','C184U00VAY','A185N00MBN','C185500EBD','C185E01VAM','A185700LAF','C1858012AX','C185401DAG','C185601JBV','A185500WAQ','A185800HBG','C185F01BAV','C185F02NBN','C185F02NBM','A185P01CAK','A185400SAK','A185W00LBJ','A185402TBN','A185502BCK','A184W022AU','A185M00GBX','C185E01SBH','C185E01HBV','A185T009AD','C185501WAM','C185G01CAE','C185M00EBG','C184M02BBR','A185T021AP','A185V00LBA','C185501MCJ','C185401DBR','A185C013BU','C185800CCA','A185601HBB','C184W009AD','C185700DBL','A184T020AC','A185700YAS','A185T021AL','C185E01VBR','A185900JBH','A185L00ACE','C185E01LAM','A185W00NAD','C1858011AU','C185800DCH','C185G002AP','A185S012BS','A185V02BAX','A185T02ACE','A185T027AR','C185F02QBV','A185N00MBP','C185M01NAG','C185P02NCK','C185G004AR','A185U015AV','C185U00CBE','C185501VCE','C1851009AW','A185P01GAV','C185G008AC','C185E01JBB','A1856003BU','A184U00UBJ','A185700HAA','A185L00KBB','A185K00ABX','C1853028AF','C185G002BQ','C184Q02SAV','C184P02BAU','A185U00LAT','C183Q01MBX','A185900XAX','C185B00GAA','C185E01LAA','C185D01YCB','C185401LCC','C185F018AW','C185800YAR','C185E01VAH','C184L007BT','A185M004AB','A185U00YBY','C185B00VAS','A185V019AW','C185Q02RBL','C185700DBH','C185800YBS','C1858011CK','C185E01SBF','A185L00PAD','A185L00AAL','C185U008BV','A185T02FCA','A185U00MAU','A185V017CD','A185V017AY','A185L009BF','A185N006CC','C185B00UAD','A185U00XAH','C185701JAF','C185601HCD','C183L017AC','C185P02PBS','C185Q01TBX','A185M00EAA','A185P018CH','A185S01CBK','A185S00VAV','A185U022AF','A185U023BJ','A185U014AT','A185K00GBH','A185J00HCE','A185K00PAY','C184T01FAF','C185101BBW','A185U013BA','C185T01TBE','A185K00XAF','C184V00VAK','A185S016AV','A1853017BT','A185K004AP','C185501LCG','A185P01HAQ','A185U011BT','A185W004AW','A185N00JAQ','A185V015BV','C185F02QBU','C185L01HAY','A185S016AY','A185S01BAD','C186100PBQ','C185700DBD','C185800FAU','C185K016AN','A185W004CG','A185S017AW','A1855022BV','C185F017AG','A185G003AC','C185E01MBM','C185E01MBV','A1857019AX','C185E01UCD','C185G00SAC','C185G004BQ','A185H00MBP','C185G004BR','C185E01XBW','A1853003BU','A185400WAN','A185501EAM','A184T01QBL','A185M00KBD','A185M008AH','C185800BAD','C184S00SBG','C185E01VBS','A184W00JAS','A184M01PBS','C185G008BU','C1834009CG','A1857010BD','C185E01SAP','A1854038BT','C185401BBS','C185E01PCJ','C1854012BR','C185F02HAD','A185202VCJ','A185800SBQ','A185500UCJ','C185E01HBT','C185F02PCK','C184U00RAX','A185403CBM','C184S00CBT','C185G008AM','C185G00ACF','A185200FBD','C185701JBM','C185E01UAW','C185F02RAN','C184L029AV','C185E01VAF','C185G00RBJ','A185501DBS','C185E01JAM','C185E01RBU','C185601CAG','C185P02PAV','C185100NBW','C185401DAJ','A185700YBA','A185800UBK','C185G00SBW','C185400JBP','C1855010BY','A185403CAC','C185D00QBQ','C185D00QBK','A185800UAV','C185D02EBY','C185900XAT','C185C02BCD','A185H00NBF','A185N005AL','A185502JAL','C184W01AAM','A185402UAG','C185100QBA','A185200HBX','C185600FAL','A184V00DBC','A185L00ABM','C185G00RAT','A184V02VBX','A1854039BS','A185A00RBL','A185601RBN','A1854039CA','A185R016BQ','C185G009AU','A185400NAT','A185601XCD','A185T024AT','C184V00WBC','C1856027BJ','C184D01HAW','C185901UBA','C185901XAT','C185901XBC','C185300PBA','A185601HAD','A185L00ACG','A185800WAX','A185400NBR','C185800BBS','C1855007AF','C185F02HBX','A185501CCH','A185401WBQ','A185900WBU','A185700VBC','C1852022AK','A185C013AX','A1857013CK','A184V00XBP','C184G02JAA','A185800SAX','A1853009CF','A1853002AB','A185Q00QAU','A185L00NBG','C185E01KAJ','C185F02HAE','C185F02NAE','C185F02MBA','C185G00AAR','C185E01VBV','A185400YBR','C184H00YCD','C185A00NCD','A185V026CB','C185F02KBF','A185L00RAA','C185G004AM','C185F01AAC','C185G005BN','C185200FAA','C185F02RBQ','C185F02NCF','A185U015BU','C185M00BBB','A185T021BB','A185V015BH','A185W013BX','A185W016BL','C185400LBY','A184G00XCD','A185700YAV','A185T009AQ','A184H01GAD','A1857011AW','A185800FCC','A185800HBM','A185900JBN','A185800FBL','A185502NAH','A184V018AK','A185L00ABK','C185F016BB','A185L00ACH','A185J00KAR','A185W00LBT','C185G009AV','C185F02PAS','A185X008AE','A185U015AU','C185M00GCA','C184U00BAR','A185H003AK','A185S019CG','A185M007AV','C185M01SBH','A1856003AF','A185L00RAB','A185Q00PBY','C185R00VBD','A185800WAN','C185F02JBX','C185M03DAY','A1856005BC','A185V02CBU','C185F02LAD','A185D00ECD','C185E01VBW','C185E01LBF','C185D02GAN','C185F01EAD','C1858013BC','C185700DBT','C185G008CC','C185M01NCD','C184T00MAV','C1856011BN','C185F02HCF','C1853029AK','C185E01WBT','C185700RCC','C185F02JAX','C185500FCJ','C185500BAQ','C185D01QAP','C185T01NCC','C185F02MCH','A1851026AM','C185301VBT','C183800YBE','C185300MBC','C185E01UBK','C185F02MBR','A185M00CBM','A185K004AJ','C185Q036BA','A185V02CBK','A185W00QAD','C184W00VCE','A185A00RBY','A185L00HBG','C185F02QBH','C184Q02NAD','A185S01CBJ','A185W00HAP','A185L00JAK','C185G01FBC','A185C01QCD','C184W00FAA','C1852005BF','C185Q02RBP','A185M00EAM','A185L00FBM','C185L01PAT','A185K00SAS','A185V00MAN','A185K003BH','C1854013AT','C185B00DAG','C185G009BA','C1852005BC','C184Q006BM','A185M005BF','A185G00KAY','A185T029CE','C184L02DBC','C185F02GAT','A185S014CC','A185K00GAR','C185501PAT','A185T02BAT','A185T021AU','A185N00JBP','A185L00BBF','A185N00KBG','A185K00PBA','A185K003AL','A185K00TAG','C185A019BK','C185B00SBA','A185T023BH','C184S00UAY','C1859010BE','A185U012BM','A185Q00WBD','C185C029AY','A185S00YBU','C185P017AH','A185U011AS','A185W00PCA','A185W00MAB','C185900CCG','C185R026AK','C184T00KBS','C185601JCF','C185100UAA','A1853015BG','C185201QAR','A185501EAQ','A185601NCD','A1851013BB','A185502KBM','C185G00BAB','C185G003BB','C185G00AAE','A1856004AN','C185201QAH','C185G009AR','C185G00ACD','A185403CCE','C184W00GCG','A185402TAB','A1854033CE','C185E01TAS','A185F006AR','C185F02JBF','C185601JBC','C185E01MCB','C185F015BY','A185H00MBL','C185F02RBH','A1855022BH','A185300BAC','A184T01TCD','A1855022AY','A1856019CB','A1856019CD','A184V018AR','A1854039AY','A1854039AJ','C184W007CG','A185H00LBR','A185M004AR','A185N00MAW','C185100MCC','C185F01DAJ','C185G004CF','C185F02LBY','C185E01VBK','A185800NCD','C185E01MBY','C185F015AC','C185E01NBV','C185E01PAD','C184W006AU','C184W006BQ','C185G008AG','C185F02JBH','A185200KBL','C185G00UCB','C185E01UCB','A185300ABB','C185G003BW','C185F01AAE','C185G003AB','C185E01LAF','A185A00SAR','A185200FCJ','A1852023CA','A1856010AL','A185200FBW','A184T01PAA','A1851026AF','C185F02RAJ','C185G004AW','C185F01EAW','A1852038BE','A184U00UAQ','C185G00SAK','A185500SCK','C185F016AH','C185F02KAW','C1858014AM','A185200FAU','A1852023CK','C1851018AR','C184V016CF','A1853002AX','C185E01MCA','C185F018BF','C185700RAH','A185700GCA','A185800PBC','A185701ABQ','A185701AAV','A185K00DCC','C1856024BU','C185101GBV','C1857003BH','C1854013CD','C185A00KAT','A185K00UAJ','C1855017BV','C185R00QBC','C185T01TBP','A1853002AF','A1853005AK','C185G00UAU','C185R012BC','C185301UAU','C185Q01RCF','C185G007BL','C185401HBH','C1856013CA','C1855008BC','A1856003BT','C1857019CJ','C185401DBH','A185501CBK','A185700WAE','A185G00NBA','A1851014BK','A185401WBE','C185101GBC','A185C01KBQ','A185Q00LBQ','C184W00GBF','C185G00BCA','C185800YAF','A185502JBH','C185401ABE','C184U00EBH','A185J00MBB','C185500PAF','C185G004AU','A1854033BL','C185F01CCF','C184N01MAK','A185502LAU','C185800WBK','C185301UBJ','A185T02EAJ','A185S01AAV','A185601AAT','A185T02BCG','A185T029CD','C185G005BH','A185800PBK','A185800PBA')";
        String hql3=hql.toString()+" and materialname in ('C185E01KBV','C184Q00CAA','C184U00WBL','A185V02AAH','A185C01KBV','C185F019BR','C185E01WCG','C184L00RAH','C185F019AY','C1855009AP','A185S012AA','C184W00ABT','A185V032BT','A185V032BS','C185E01RAD','C185F02PCD','A185U024AD','A185C013CA','C1858011AF','A184V02FCK','C185401LCG','C185A00NBF','A185A00RBB','C1857004BR','A185701EBP','A185N00LBS','C185E01PAK','A185S014CB','A185502MBU','C185G003BN','A185V018BB','C185F02PAJ','C185E01MBC','C185G003AL','A185T026CD','A185R010BD','C1855018AD','A185S012BJ','A185N00JAM','C185101EAU','A185L009BC','C185100SAS','A185U015BM','A185U00YBS','A185K00HBN','C185401KAK','A185P00LBE','A185402UBR','A184T01VBK','C185200GAQ','A185T025BW','A185U022AV','C185F01ECD','A1857018CJ','C185F01BCC','C185T01SBH','C185E01HCG','A185900WBJ','C185701BBB','A185800FCH','C185G006CA','A184V02WAG','C185701BCK','C1859011BL','A185L00EAW','C185G008AW','A185N007AU','C185G009CF','C185E01NBH','C185G00ABB','C185E01HCK','C184H009CH','C185G00RAC','C185501MCK','C1853026AE','C185501WBM','C185A00GBM','C185A00YBV','C185F02QBS','A185N00MBL','A185800HBT','C185E01PBG','C185E01XCB','A185T02CAR','C185302KCB','A185U016BE','A185Q00DBC','C184N026CB','C1855016BW','C185701GCE','C184T00TBH','C185G00RBC','C184W00XAX','A185L00AAW','A185W013BR','C185U00ACD','A185W00GAH','A185P00TBH','C185800YBF','A185K00XAL','A185K00CCG','A1857015BY','C184Q003CD','A185N00DBY','A185L00ABA','C185F02KBY','C185B011AB','C185600QCE','A185P01HBT','A185S018CF','A185L00BBS','A185U011AU','A185K00GBC','C185Q02QCF','C185G009AW','C1856027CF','C1853025CE','C185U00MCG','A185H00SBU','A185J00QAU','A185K00CBT','A184T02JBP','A185P019CH','A185M00MAS','C185300QCF','A185V017BY','C185501UBK','A185P01HAT','A185W00MAG','A185V01AAX','A185W00GBD','A185W00KAR','C185600FAP','C184P01NAU','C185N014AJ','A185V02ACJ','A185Q00SBB','C1856025BM','A185W00NAK','A185V02BCF','A185X007BR','A185V00MCC','C185L01FBY','C185M008CJ')";

        List<SpcDcdata> list1=mesdao.list(SpcDcdata.class, hql1);
        List<SpcDcdata> list2=mesdao.list(SpcDcdata.class, hql2);
        List<SpcDcdata> list3=mesdao.list(SpcDcdata.class, hql3);
        if(!list2.isEmpty()) list2.forEach(e->list1.add(e));
        if(!list3.isEmpty()) list3.forEach(e->list1.add(e));

        return list1;
    }

    public List<SpcDcResultData> loadMDataList(EtlConfDModel etlConfD, long dcdataid) {
        List<SpcDcmeasuredataresult> spcDcmeasuredataresultList =new ArrayList<>();
        List<SpcDcResultData> spcDcResultDataList=new ArrayList<>();
        StringBuffer hql = new StringBuffer();
        hql.append("FROM SpcDcmeasuredataresult WHERE dcdataid =").append(dcdataid)
        .append(" order by itemname, sitename");
        spcDcmeasuredataresultList =mesdao.list(SpcDcmeasuredataresult.class, hql.toString());
        spcDcmeasuredataresultList.forEach(e->{
            SpcDcResultData spcDcResultData=new SpcDcResultData();
            spcDcResultData.setDcdataid(e.getDcdataid());
            spcDcResultData.setSeq(e.getSeq());
            spcDcResultData.setSamplematerialname(ProcessUtil.processString(e.getSamplematerialname()));
            spcDcResultData.setItemname(ProcessUtil.processString(e.getItemname()));
            spcDcResultData.setSitename(ProcessUtil.processString(e.getSitename()));
            spcDcResultData.setSitetype(ProcessUtil.processString(e.getSitetype()));
            spcDcResultData.setAliasitemname(ProcessUtil.processString(e.getAliasitemname()));
            spcDcResultData.setDatatype(ProcessUtil.processString(e.getDatatype()));
            spcDcResultData.setResult(ProcessUtil.processString(e.getResult()));
            spcDcResultData.setEventname(ProcessUtil.processString(e.getEventname()));
            spcDcResultData.setTimekey(ProcessUtil.processString(e.getTimekey()));
            spcDcResultData.setEventtime(e.getEventtime());
            spcDcResultData.setEventuser(ProcessUtil.processString(e.getEventuser()));
            spcDcResultData.setEventcomment(ProcessUtil.processString(e.getEventcomment()));
            spcDcResultData.setUpdatetime(e.getUpdatetime());
            spcDcResultDataList.add(spcDcResultData);
        });
        return spcDcResultDataList;
    }

    public List<SpcDcResultData> loadPDataList(EtlConfDModel etlConfD, long dcdataid) {
        List<SpcDcprocessdataresult> spcDcprocessdataresult =new ArrayList<>();
        List<SpcDcResultData> spcDcResultDataList=new ArrayList<>();
        StringBuffer hql = new StringBuffer();
        hql.append("FROM SpcDcprocessdataresult WHERE dcdataid =").append(dcdataid)
                .append(" order by itemname, sitename");
        spcDcprocessdataresult =mesdao.list(SpcDcprocessdataresult.class, hql.toString());
        spcDcprocessdataresult.forEach(e->{
            SpcDcResultData spcDcResultData=new SpcDcResultData();
            spcDcResultData.setDcdataid(e.getDcdataid());
            spcDcResultData.setSeq(e.getSeq());
            spcDcResultData.setSamplematerialname(ProcessUtil.processString(e.getSamplematerialname()));
            spcDcResultData.setItemname(ProcessUtil.processString(e.getItemname()));
            spcDcResultData.setSitename(ProcessUtil.processString(e.getSitename()));
            spcDcResultData.setSitetype(ProcessUtil.processString(e.getSitetype()));
            spcDcResultData.setAliasitemname(ProcessUtil.processString(e.getAliasitemname()));
            spcDcResultData.setDatatype(ProcessUtil.processString(e.getDatatype()));
            spcDcResultData.setResult(ProcessUtil.processString(e.getResult()));
            spcDcResultData.setEventname(ProcessUtil.processString(e.getEventname()));
            spcDcResultData.setTimekey(ProcessUtil.processString(e.getTimekey()));
            spcDcResultData.setEventtime(e.getEventtime());
            spcDcResultData.setEventuser(ProcessUtil.processString(e.getEventuser()));
            spcDcResultData.setEventcomment(ProcessUtil.processString(e.getEventcomment()));
            spcDcResultData.setUpdatetime(e.getUpdatetime());
            spcDcResultDataList.add(spcDcResultData);
        });
        return spcDcResultDataList;
    }


    private String getOpeHql(String confOpe) {
        if (StringUtils.isEmpty(confOpe)) {
            return "";
        }

        StringBuffer hql = new StringBuffer();
        if ("*".contains(confOpe)) {
            //todo 允许模糊匹配
        } else {
            hql.append(" and opeId='").append(confOpe).append("' ");
        }

        return hql.toString();
    }


}
